package com.zuo.demo01.pojo;

import com.fasterxml.jackson.annotation.JsonFormat;

import java.text.SimpleDateFormat;
import java.util.Date;

public class Comment {

    private Integer id;
    private Blog blog;
    private String commentator;
    private String email;
    private String url;
    private String content;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date commentTime;
    private String ip;
    private String replyContent;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date replyTime;
    private Integer status;

    @Override
    public String toString() {
        return "Comment{" +
                "id=" + id +
                ", blog=" + blog +
                ", commentator='" + commentator + '\'' +
                ", email='" + email + '\'' +
                ", url='" + url + '\'' +
                ", content='" + content + '\'' +
                ", commentTime=" + commentTime +
                ", ip='" + ip + '\'' +
                ", replyContent='" + replyContent + '\'' +
                ", replyTime=" + replyTime +
                ", status=" + status +
                '}';
    }

    public Comment() {
    }

    public Comment(Integer id, Blog blog, String commentator, String email, String url, String content, Date commentTime, String ip, String replyContent, Date replyTime, Integer status) {
        this.id = id;
        this.blog = blog;
        this.commentator = commentator;
        this.email = email;
        this.url = url;
        this.content = content;
        this.commentTime = commentTime;
        this.ip = ip;
        this.replyContent = replyContent;
        this.replyTime = replyTime;
        this.status = status;
    }

    public Comment(Integer id, Blog blog, String commentator, String email, String url, String content, String ip, String replyContent, Integer status) {
        this.id = id;
        this.blog = blog;
        this.commentator = commentator;
        this.email = email;
        this.url = url;
        this.content = content;
        this.ip = ip;
        this.replyContent = replyContent;
        this.status = status;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Blog getBlog() {
        return blog;
    }

    public void setBlog(Blog blog) {
        this.blog = blog;
    }

    public String getCommentator() {
        return commentator;
    }

    public void setCommentator(String commentator) {
        this.commentator = commentator;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getCommentTime() {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        if(this.commentTime==null){
            return null;
        }
        return sdf.format(this.commentTime);
    }

    public void setCommentTime(Date commentTime) {
        this.commentTime = commentTime;
    }

    public String getIp() {
        return ip;
    }

    public void setIp(String ip) {
        this.ip = ip;
    }

    public String getReplyContent() {
        return replyContent;
    }

    public void setReplyContent(String replyContent) {
        this.replyContent = replyContent;
    }

    public String getReplyTime() {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        if(this.replyTime==null){
            return null;
        }
        return sdf.format(this.replyTime);
    }

    public void setReplyTime(Date replyTime) {
        this.replyTime = replyTime;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }
}
